<#
跨模型路由守卫检查（原生 PowerShell）
用途：检查 rules/model_routing_guide.md 是否存在且被 docs/meta_index.md 引用。
用法：
  pwsh -File scripts/windows/cross-model-guard.ps1
#>
param()

$WindowsDir = Split-Path -Parent $PSCommandPath
$ScriptsDir = Split-Path -Parent $WindowsDir
$RepoDir = Split-Path -Parent $ScriptsDir

$guide = Join-Path $RepoDir 'rules/model_routing_guide.md'
$meta = Join-Path $RepoDir 'docs/meta_index.md'

$ok = $true
if (!(Test-Path $guide)) { Write-Warning "缺少路由指南：$guide"; $ok = $false }
if (!(Test-Path $meta)) { Write-Warning "缺少 meta_index：$meta"; $ok = $false }
elseif ((Get-Content -Raw $meta) -notmatch [regex]::Escape('rules/model_routing_guide.md')) { Write-Warning "meta_index 未索引 model_routing_guide.md"; $ok = $false }

if ($ok) { Write-Host "跨模型路由守卫检查通过"; exit 0 } else { exit 2 }
